import fs from "fs";
import iconv from "iconv-lite";

const getContent = (originFilePath, encoding = 'utf-8') => {
    return new Promise((resolve,reject) => {
        try {
            let file = fs.readFileSync(req.originFilePath, {encoding: 'binary'})
            let buffer = Buffer.from(file, 'binary')
            let data = iconv.decode(buffer, req.encoding)
            resolve(data)
        } catch (e) {
            reject(e)
        }

    })
}